package com.example.bms.serviceimpl;

import com.example.bms.entity.Replay;
import com.example.bms.mapper.ReplayMapper;
import com.example.bms.service.ReplayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;


/**
 * @apiNote 用于回复记录的增删改查
 * @author 武子砚
 * @email 2681413363@qq.com
 * @since 1.0.0
 */
@Service
@Transactional
public class ReplayServiceImpl implements ReplayService {

    @Autowired
    private ReplayMapper replayMapper;


    /**
     * @apiNote 查询所有回复记录
     * @author 武子砚
     * @email 2681413363@qq.com
     * @return List<Replay>
     * @since 1.0.0
     */
    @Override
    public List<Replay> findAll() {
        return replayMapper.findAll();
    }


    /**
     * @apiNote 根据消息Id查询回复记录
     * @author 武子砚
     * @param messageId  消息Id
     * @email 2681413363@qq.com
     * @return List<Replay>
     * @since 1.0.0
     */
    @Override
    public List<Replay> findAllById(Integer messageId) {
        return replayMapper.findAllById(messageId);
    }


    /**
     * @apiNote 根据回复Id查询回复记录
     * @param replayId 回复id
     * @author 武子砚
     * @email 2681413363@qq.com
     * @return Replay
     */
    @Override
    public Replay findById(Integer replayId) {
        return replayMapper.findById(replayId);
    }


    /**
     * @apiNote 删除回复记录
     * @author 武子砚
     * @email 2681413363@qq.com
     * @return Replay对象
     * @since 1.0.0
     */
    @Override
    public int delete(Integer replayId) {
        return replayMapper.delete(replayId);
    }


    /**
     * @apiNote 修改回复记录
     * @author 武子砚
     * @email 2681413363@qq.com
     * @return int类型，表示受影响的数据
     * @since 1.0.0
     */
    @Override
    public int update(Replay replay) {
        return replayMapper.update(replay);
    }


    /**
     * @apiNote 增加回复记录
     * @param replay 回复对象
     * @author 武子砚
     * @email 2681413363@qq.com
     * @return int类型，表示受影响的数据
     * @since 1.0.0
     */
    @Override
    public int add(Replay replay) {
        return replayMapper.add(replay);
    }
}
